home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 925 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.8 KB

  1. Path: chronicle.mti.sgi.com!austern
  2. From: abell@mindspring.com (Andrew Bell)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: fstream constructors and strings
  5. Date: 01 Apr 1996 10:39:30 PST
  6. Organization: MindSpring Enterprises
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <4jnm7h$134a@mule2.mindspring.com>
  9. References: <315A8E72.1D3C@master.grad.hr>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: Mon, 01 Apr 1996 04:34:14 GMT
  12. X-Newsreader: Forte Agent .99.82
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBVAwUBMWAi40y4NqrwXLNJAQEBTgIAtoA94ljOCaHfXXLy01Lf/fvX1I1bVMCO
  15.     uGnfMtrZreDtZRYUpTRKfthHhR3w4iERkcG6HXSigW4EZ/txNUPoKg==
  16.     =bwJy
  17. Originator: austern@isolde.mti.sgi.com
  18.  
  19. Kresimir Fresl <fresl@master.grad.hr> wrote:
  20. >According to proposed standard one should write:
  21. >    ifstream (file_name.c_str());
  22. >because implicit conversion of string to const char* is not defined.
  23.  
  24. >I agree that implicit conversion is (almost always) dangerous, and I
  25. >_do not_ propose to add conversion operator to string class.
  26.  
  27. Is there an explanation for why implicit conversion (at least to char
  28. *) is dangerous?  It doesn't seem to me that requiring the member
  29. function call is that much safer, although admittedly it is easier to
  30. grep for.  However, the added complexity of code w/o a conversion
  31. operator seems like it would add almost as many problems.
  32.  
  33. I checked out the std.c++ faq, and I've read the lang.c++ faq not too
  34. long ago, and I didn't see a reference to this in either.
  35.  
  36. Andrew Bell
  37. abell@mindspring.com
  38. ---
  39. [ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
  40.                 newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  41.   comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  42.   Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  43.   Comments? mailto:std-c++-request@ncar.ucar.edu 
  44. ]
  45.